﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResetPass.aspx.cs" Inherits="ShowRoom.admin.ResetPass" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <center>
   <div style="width:100%;text-align:center;color:#C794BA;font-weight:bold;margin-bottom:10px;margin-top:15px;"><asp:Label ID="lblTil" runat="server" Text="CẬP NHẬT MẬT KHẨU"></asp:Label></div>       
        <table id="tblMaster" runat="server" bordercolor="#E1E1E1"  border="1" cellpadding="0" cellspacing="0" width="90%"
            style="border-collapse: collapse;">              
            <tr id="tr1" runat="server">
                <td style="width: 20%; height: 21px;text-align:right;padding-right:10px;height:30px" nowrap>
                    Mật khẩu củ<font color="red">*</font>:</td>
                <td style="width: 80%; text-align: left; height: 21px;;padding-left:5px" >
                    <asp:TextBox ID="txtPassCurr" TextMode="Password"  CssClass="cssTextBox" Width="70%" runat="server"></asp:TextBox>
                    <asp:Label ID="lblPassCurr" runat="server" ForeColor="#CC3300"></asp:Label>
                </td>
            </tr>
           <tr id="trPass" runat="server">
                <td style="width: 20%; height: 21px;text-align:right;padding-right:10px;height:30px" nowrap>
                    Mật khẩu mới <font color="red">*</font>:</td>
                <td style="width: 80%; text-align: left; height: 21px;;padding-left:5px" >
                    <asp:TextBox ID="txtPass" TextMode="Password"  onblur="CheckPass(this);" CssClass="cssTextBox" Width="70%" runat="server"></asp:TextBox>
                    <asp:Label ID="lblPassIn" runat="server" ForeColor="#CC3300"></asp:Label>
                </td>
            </tr>
            <tr  id="trPassC" runat="server">
                <td style="width: 20%; height: 21px;text-align:right;padding-right:10px;height:30px" nowrap>
                    Nhập lại mật khẩu <font color="red">*</font>:</td>
                <td style="width: 80%; text-align: left; height: 21px;;padding-left:5px" >
                    <asp:TextBox ID="txtPassC" onblur="CheckPassRep(this);" TextMode="Password" CssClass="cssTextBox" Width="70%" runat="server"></asp:TextBox>
                    <asp:Label ID="lblPassInRep" runat="server" ForeColor="#CC3300"></asp:Label>
                </td>
            </tr>
              <tr>
                <td class="ActDocTD2" style="height: 30px">
                    &nbsp;</td>
                <td style="text-align: left; height: 21px;" align="center" class="ActDocTD3">
                    <asp:Button ID="btnSave" CssClass="button" runat="server" Text="Save"  OnClientClick="return fnSave();"
                       onclick="btnSave_Click"  Width="75px" />&nbsp;<asp:Button ID="btnCancel" 
                        CssClass="button" runat="server"
                            Text="Cancel" Width="75px" onclick="btnCancel_Click" /></td>
            </tr>
        </table>
        </center>
        
    </form>
      <script type="text/javascript">         

          //kiểm tra pass
          function CheckPass(obj) {
              var length = obj.value.length;
              if (length < 6)
                  document.getElementById("<%= lblPassIn.ClientID%>").innerHTML = "Phải nhiều hơn 5 ký tự !";
              else {
                  document.getElementById("<%= lblPassIn.ClientID%>").innerHTML = "";
                  document.getElementById("<%= txtPass.ClientID%>").className = "CssNotOk";
              }

              var passRep = document.getElementById("<%= txtPass.ClientID%>").value;
              if (passRep != "") {
                  if (obj.value == passRep) {
                      document.getElementById("<%= lblPassInRep.ClientID%>").innerHTML = "";
                      document.getElementById("<%= txtPass.ClientID%>").className = "cssTextBox";
                  }
                  else
                      document.getElementById("<%= lblPassInRep.ClientID%>").innerHTML = "mật khẩu phải giống nhau!";
              }

          }
          function CheckPassRep(obj) {
              var length = obj.value.length;
              var pass = document.getElementById("<%= txtPass.ClientID%>").value;
              if (obj.value != pass)
                  document.getElementById("<%= lblPassInRep.ClientID%>").innerHTML = "mật khẩu phải giống nhau!";
              else {
                  document.getElementById("<%= lblPassInRep.ClientID%>").innerHTML = "";
                  document.getElementById("<%= txtPass.ClientID%>").className = "cssTextBox";
              }
          }


          // save data
          function fnSave() {
              // kiểm tra mật khẩu
              if (document.getElementById("<%= txtPassCurr.ClientID%>").value == "" || document.getElementById("<%= lblPassCurr.ClientID%>").innerHTML != "") {
                  document.getElementById("<%= txtPassCurr.ClientID%>").className = "CssNotOk";
                  return false;
              }
              if (document.getElementById("<%= txtPass.ClientID%>").value == "" || document.getElementById("<%= lblPassIn.ClientID%>").innerHTML != "") {
                  document.getElementById("<%= txtPass.ClientID%>").className = "CssNotOk";
                  return false;
              }
              if (document.getElementById("<%= txtPassC.ClientID%>").value == "" || document.getElementById("<%= lblPassInRep.ClientID%>").innerHTML != "") {
                  document.getElementById("<%= txtPassC.ClientID%>").className = "CssNotOk";
                  return false;
              }

          }

      </script>
</body>
</html>
